
/*
 * @Date: 2024-11-22 10:06:39
 * @Author: LiSong
 * @LastEditors: LiSong
 * @LastEditTime: 2024-12-23 10:11:35
 * @Description: 我的任务
 */
import schema from './schema.js'

import { useDbSource } from '@hp/hooks/useDbSource.js'

const { loadDataCols, loadDataChildCols } = useDbSource()

export default {
  // 组件
  component: () => import("./MyTask.vue"),
  // 类型
  type: 'myTask',
  // 名称
  name: '我的任务',
  // 图标或图片
  icon: 'pi/my-task.png',
  // 初始配置
  schema,
  // 大小定位
  layout: {
    i: '',
    x: '',
    y: '',
    w: 60,
    h: 24,
    minW: 60,
    minH: 24,
    maxW: 120,
    maxH: 72,
    static: false,
  },
  // 配置
  config: [
    {
      config: {
        label: '基础配置'
      },
      children: [
        {
          type: 'input',
          field: 'desc',
          label: '描述',
          compProps: {
          }
        },
        {
          type: 'switch',
          field: 'showHeader',
          label: '显示头部',
          compProps: {
          }
        },
      ]
    },
    {
      config: {
        label: '数据配置'
      },
      children: [
        {
          type: 'input-dbsource',
          field: 'dataSource',
          label: '数据源',
          noForm: false,
          compProps: {
          }
        },
      ]
    },
    {
      config: {
        label: '任务配置'
      },
      children: [
        {
          type: 'input-cards',
          field: 'taskList',
          label: '数据集',
          noForm: true,
          compProps: {
          },
          children: [
            {
              type: "input",
              label: "名称",
              field: "taskList.name",
              compProps: {
              }
            },
            {
              type: "select",
              label: "类型",
              field: "taskList.type",
              compProps: {
                clearable: true,
                getUpConfig({ schema }) {
                  return {
                    options: loadDataChildCols(schema.id, 'root')
                  }
                }
              }
            },
            {
              type: "series-task",
              label: "状态项",
              field: "taskList.statusItems",
              compProps: {
              }
            },
          ]
        },
      ]
    },
  ]
}